import Vue from 'vue';
import {
  SPIN_LOADING,
  RESET_BASEURL
} from '@/store/mutation-types';

const app = {
  state: {
    loading: false,  //加载中全局覆盖
    resetBaseUrl: false  //是否手动更改IP地址
  },
  mutations: {
    [SPIN_LOADING]: (state, loading) => {
      state.loading = loading
    },
    [RESET_BASEURL]: (state, resetBaseUrl) => {
      state.resetBaseUrl = resetBaseUrl
    },
  },
  actions: {
    setSpinLoading({ commit }, loading) {
      commit(SPIN_LOADING, loading)
    },
    resetBaseUrl({ commit }, resetBaseUrl) {
      commit(RESET_BASEURL, resetBaseUrl)
    }
  }
}

export default app;